#ifndef CHARTFORM_H
#define CHARTFORM_H

#include <QWidget>
#include <unordered_set>

class Graph;
namespace Ui {
class ChartForm;
}
class CurveEditor;
class ChartForm : public QWidget
{
    Q_OBJECT

public:
    explicit ChartForm(QWidget *parent = nullptr);
    ~ChartForm();

public:
    QString addCurve(const QString& name);
    void selectCurve(const QString& id);
    void clearSelectCurve(const QString& id="");
    void deleteCurve(const QString& id = "");
    QColor getCurveColor(const QString& id) const;
public slots:
    void positionChanged(QPointF position);
    void selectPointChanged(bool hasSelect);
    void movePoint(QPointF offset);
signals:
    void changedPosition(QPointF position);
private:
    Ui::ChartForm *ui;
    std::unordered_set<QString> m_curveIds;
protected:
    void paintEvent(QPaintEvent *event);
private slots:
    void on_doubleSpinBoxY_editingFinished();
    void on_doubleSpinBoxX_editingFinished();
    // QWidget interface

    void on_comboBoxEditCurve_currentIndexChanged(int index);
};

#endif // CHARTFORM_H
